package com.example.expinterview.controller;

import com.example.expinterview.entity.ResultBody;
import com.example.expinterview.service.IWxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @classname: WxController
 * @description: TODO
 * @author: kaiser
 * @date: 2021/10/20 16:19
 * @version: 1.0
 */
@RestController
@RequestMapping("/wx")
@Api(tags = "微信接口")
public class WxController {
    private final IWxService service;

    @Autowired
    public WxController(IWxService service) {
        this.service = service;
    }

    @GetMapping("/getOpenid/{code}")
    @ApiOperation(value = "获取微信的openid")
    public ResultBody getOpenid(@PathVariable String code) {
        return service.wxLogin(code);
    }
}
